<template>
  <div>
    <span>普通工人</span>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="满足率">
        <el-input v-model="formInline.satisfy" placeholder="满足率"></el-input>
      </el-form-item>
      <el-form-item label="变动原因">
        <el-input v-model="formInline.changereason" placeholder="变动原因"></el-input>
      </el-form-item>
      <el-form-item>
        <el-select v-model="formInline.comparison" placeholder="上升/下降/不变">
          <el-option label="上升" value="1"></el-option>
          <el-option label="下降" value="2"></el-option>
          <el-option label="不变" value="3"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-date-picker type="date" placeholder="选择日期" v-model="formInline.creatdate" style="width: 100%;"></el-date-picker>
      </el-form-item>
    </el-form>

    <span>技术人才</span>
    <el-form :inline="true" :model="technology" class="demo-form-inline">
      <el-form-item label="满足率">
        <el-input v-model="technology.satisfy" placeholder="满足率"></el-input>
      </el-form-item>
      <el-form-item label="变动原因">
        <el-input v-model="technology.changereason" placeholder="变动原因"></el-input>
      </el-form-item>
      <el-form-item>
        <el-select v-model="technology.comparison" placeholder="上升/下降/不变">
          <el-option label="上升" value="1"></el-option>
          <el-option label="下降" value="2"></el-option>
          <el-option label="不变" value="3"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-date-picker type="date" placeholder="选择日期" v-model="technology.creatdate" style="width: 100%;"></el-date-picker>
      </el-form-item>
    </el-form>

    <span>高端人才</span>
    <el-form :inline="true" :model="upscale" class="demo-form-inline">
      <el-form-item label="满足率">
        <el-input v-model="upscale.satisfy" placeholder="满足率"></el-input>
      </el-form-item>
      <el-form-item label="变动原因">
        <el-input v-model="upscale.changereason" placeholder="变动原因"></el-input>
      </el-form-item>
      <el-form-item>
        <el-select v-model="upscale.comparison" placeholder="上升/下降/不变">
          <el-option label="上升" value="1"></el-option>
          <el-option label="下降" value="2"></el-option>
          <el-option label="不变" value="3"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-date-picker type="date" placeholder="选择日期" v-model="upscale.creatdate" style="width: 100%;"></el-date-picker>
      </el-form-item>
    </el-form>

    <span>急需人才</span>
    <el-form :inline="true" :model="needs" class="demo-form-inline">
      <el-form-item label="人员缺口类型">
        <el-select v-model="needs.need" placeholder="人员缺口类型">
          <el-option label="普通工人" value="1"></el-option>
          <el-option label="技术人才" value="2"></el-option>
          <el-option label="高端人才" value="3"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="急需人才数量">
        <el-input v-model="needs.quantity" placeholder="急需人才数量"></el-input>
      </el-form-item>
      <el-form-item>
        <el-date-picker type="date" placeholder="选择日期" v-model="needs.creatdate" style="width: 100%;"></el-date-picker>
      </el-form-item>
    </el-form>
    <el-form>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      formInline: {
        satisfy: '',
        changereason: '',
        creatdate: "",
        employeetype: '1',
        state:'1',
        comparison:'',
      },
      technology:{
        percentage: '',
        changereason: '',
        creatdate: "",
        employeetype: 2,
        state:1,
        comparison:'',
      },
      upscale:{
        percentage: '',
        changereason: '',
        creatdate: "",
        employeetype: 3,
        state:1,
        comparison:'',
      },
      needs:{
        need:"",
        quantity: "",
        creatdate:"",
        employeetype: 4,
        state:1,
        comparison:null,
      },
    }
  },
  methods: {
    onSubmit() {
      const _this = this
      console.log(_this.formInline)
      axios.post('http://localhost:8081/talent/add', _this.formInline).then(function (resp) {

      })
      axios.post('http://localhost:8081/talent/add', _this.upscale).then(function (resp) {

      })
      axios.post('http://localhost:8081/talent/add', _this.technology).then(function (resp) {

      })
      axios.post('http://localhost:8081/talent/add', _this.needs).then(function (resp) {
        _this.$alert('添加成功', '', {
          confirmButtonText: '确定',
          callback: action => {
            _this.$router.push('/talent')
          }
        })
      })
    }
  }
}
</script>

<style scoped>
  .span1{
    position: absolute;
    margin-top: 80px;
    margin-left: -800px;
  }
</style>